package su.validator.core;

import java.util.ArrayList;
import java.util.List;

import lombok.Value;


@Value
public class ValidateErrors {
    private List<Error> errors = new ArrayList<>();

    public void addError(String name, String code, String msg){
        Error error = new Error(name, code, msg);
        this.errors.add(error);
    }

    public boolean hasError() {
        return !this.errors.isEmpty();
    }

    @Value
    public static class Error {
        String name;
        String code;
        String msg;
    }
}
